package com.tc.mapper;

import com.tc.dto.User;
import com.tc.myDto.UserApp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LoginMapper {
    //首先判断是否存在
    @Select("select * from user_app where open_id=#{openId}")
    User check(String openId);
    //新增微信用户
    @Insert("insert into user_app(nick_name, avatar_url, business_id, open_id, session_key) values(#{nickName},#{avatarUrl},#{businessId},#{openId},#{sessionKey})")
    void addWXUser(User user);
    //根据openid查询用户信息
    @Select("select * from user_app where open_id=#{openid}")
    UserApp selectOpenId(String openid);
}
